#ifndef DOMAINWHOISDLG_H
#define DOMAINWHOISDLG_H

#include "precomp.h"

//#include <QDialog>
//#include <QObject>
//#include <QSqlDatabase>
//#include <QSqlQuery>
//#include <QSqlError>
//#include <QPushButton>
//#include <QLineEdit>
//#include <QComboBox>
//#include <QMessageBox>
//#include <QTableView>
//#include <QSqlTableModel>

class TDomain ;

class DomainWhoisDlg : public QDialog
{
    Q_OBJECT
public:
    explicit DomainWhoisDlg(QWidget *parent = nullptr);
    ~DomainWhoisDlg();

private slots:
    void openDatabase();
    void createTable();
    void insertRecord();
    void updateRecord();
    void deleteRecord();
    void displayRecords();

private:
    QSqlDatabase m_db;
    QLineEdit *m_nameLineEdit;
    QLineEdit *m_ageLineEdit;
    QComboBox *m_idComboBox;
    QPushButton *m_createButton;
    QPushButton *m_insertButton;
    QPushButton *m_updateButton;
    QPushButton *m_deleteButton;
    QPushButton *m_displayButton;
    QTableView *m_tableView;
    QSqlTableModel *m_model;
    TDomain *m_tDomain;

    void fillComboBoxWithIds();
    void clearInputFields();
    bool execQuery(const QString &sql, const QStringList &params = {});
};

#endif // DOMAINWHOISDLG_H
